import com.cw.entity.User;
import com.cw.mapper.RoleMapper;
import com.cw.mapper.UserMapper;
import com.cw.service.impl.UserServiceImpl;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.ArrayList;
import java.util.Iterator;

/**
 * @author cw
 * @since 2021/7/14 16:01
 * @deprecated
 */
public class test {
    public static void main(String[] args) {
//        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
//        UserMapper userMapper = context.getBean("userMapper", UserMapper.class);
//        System.out.println(userMapper.getUserById(1));
//        RoleMapper roleMapper = context.getBean("roleMapper", RoleMapper.class);
//        System.out.println(roleMapper.getRoleList());


        // 创建集合对象
        ArrayList<String> array = new ArrayList<String>();
        // 创建并添加元素
        array.add("hello");
        array.add("world");
        array.add("java");
        // 遍历集合
        // 普通for
        for (int x = 0; x < array.size(); x++) {
            String s = array.get(x);
            System.out.println(s);
        }
        System.out.println("------------------");
        // 增强for
        for (String s : array) {
            System.out.println(s);
        }
        System.out.println("------------------");
        // 迭代器
        Iterator<String> it = array.iterator();
        while (it.hasNext()) {
            String s = it.next();
            System.out.println(s);
        }
    }


}
